--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 0500c4df154047d5495b0b8df085c27317e49206
Parents : d722ac9
Author : Sudo-Ivan <ivan@quad4.io>
Signature : Signature validation error
Date : 2026-03-06T01:25:29-06:00
Add script to sync app version from package.json to version.py
Changes
Diff
diff --git a/scripts/sync_version.js b/scripts/sync_version.js
new file mode 100644
index 00000000..ce03cae6
--- /dev/null
+++ b/scripts/sync_version.js
@@ -0,0 +1,30 @@
+/**
+ * Sync app version from package.json to meshchatx/src/version.py.
+ * Single source of truth: edit "version" in package.json, then run:
+ * pnpm run version:sync
+ * The build script runs this automatically so Python and Electron share the same version.
+ */
+
+const fs = require("fs");
+const path = require("path");
+
+const root = path.resolve(__dirname, "..");
+const pkgPath = path.join(root, "package.json");
+const versionPyPath = path.join(root, "meshchatx", "src", "version.py");
+
+const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
+const version = pkg.version;
+if (!version || typeof version !== "string") {
+ console.error("package.json has no valid 'version' field");
+ process.exit(1);
+}
+
+const content = `"""Version string synced from package.json. Do not edit by hand.
+Run: pnpm run version:sync
+"""
+
+__version__ = "${version}"
+`;
+
+fs.writeFileSync(versionPyPath, content, "utf8");
+console.log(`Synced version ${version} to meshchatx/src/version.py`);
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────